package ypmits.videoplayer.business.vo {

	/**
	 * @author ypmits
	 */
	public class MetaDataVO {
		public var width : Number;
		public var height : Number;
		public var duration : Number;
		public var duration_minutes : Number;
		public var duration_seconds : Number;
		public var percentagedone : Number;
		public var framerate : Number;
		public var videodatarate : Number;
		public var audiodelay : Number;
		public var videocodecid : Number;
		public var canSeekToEnd : Boolean;
		public var cuePoints : Array = [];
		public var audiocodecid : Number;
		public var audiodatarate : Number;

		/**
		 * videocodecid:<br>
		 * -------------<br>
		 * 2: Sorenson H.263<br>
		 * 3: Screen video (SWF 7 and later only)<br>
		 * 4: VP6 (SWF 8 and later only)<br>
		 * 5: VP6 video with alpha channel (SWF 8 and later only)<br>
		 * <br>
		 * audiocodecid:<br>
		 * -------------<br>
		 * 0: uncompressed<br>
		 * 1: ADPCM<br>
		 * 2: mp3<br>
		 * 5: Nellymoser 8kHz mono<br>
		 * 6: Nellymoser
		 */
		public function MetaDataVO( infoobject : Object = null ) {
			if( infoobject ) {
				width = infoobject['width'];
				height = infoobject['height'];
				duration = infoobject['duration'];
				duration_minutes = Math.floor( duration / 60 );
				duration_seconds = Math.round( duration - (duration_minutes * 60) );
				percentagedone = percentagedone;
				framerate = infoobject['framerate'];
				videodatarate = infoobject['videodatarate'];
				audiodelay = infoobject['audiodelay'];
				videocodecid = infoobject['videocodecid'];
				canSeekToEnd = infoobject['canSeekToEnd'];
			
				for (var j : String in infoobject['cuePoints'] ) {
					cuePoints.push( new CuepointVO( infoobject['cuePoints'][j] ) );
				}
			
				audiocodecid = infoobject['audiocodecid'];
				audiodatarate = infoobject['audiodatarate'];
			}
		}

		
		public function toString() : String {
			var s : String = "-----------\nMetaDataVO:\n-----------";
			s += "\n\twidth: " + width;
			s += "\n\theight: " + height;
			s += "\n\tduration: " + duration;
			s += "\n\tduration_minutes: " + duration_minutes;
			s += "\n\tduration_seconds: " + duration_seconds;
			s += "\n\tframerate: " + framerate;
			s += "\n\tvideodatarate: " + videodatarate;
			s += "\n\taudiodelay: " + audiodelay;
			s += "\n\tvideocodecid: " + videocodecid;
			s += "\n\tcanSeekToEnd: " + canSeekToEnd;
			s += "\n\tcuePoints: " + cuePoints;
			s += "\n\taudiocodecid: " + audiocodecid;
			s += "\n\taudiodatarate: " + audiodatarate;
			s += "\n";
			return s;
		}
	}
}
